﻿#pragma once
#include "EventLoop.h"
#include "Buffer.h"
#include "Channel.h"
#include "HttpRequest.h"
#include "HttpResponse.h"

//#define MSG_SEND_AUTO

//封装tcp连接事件
struct TcpConnection
{
	struct EventLoop* evLoop;
	struct Channel* channel;
	struct Buffer* readBuf;//读缓存
	struct Buffer* writeBuf;//写缓存
	char name[32];
	// http 协议
	struct HttpRequest* request;//http请求结构体
	struct HttpResponse* response;//http回复结构体
};

// 初始化
struct TcpConnection* tcpConnectionInit(int fd, struct EventLoop* evloop);
int tcpConnectionDestroy(void* conn);